package com.atguigu.springcloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("configclient")
@Slf4j
@RefreshScope // 实现配置中心文件变更后，这里也同时变更
public class ConfigClientController {
    @Value("${config.info}")
    private String  configInfo;

    @GetMapping("/configInfo")
    public String getConfigInfo(){
        log.info("进来到配置中心了");
        return configInfo;
    }
}
